package cn.iocoder.springboot.lab13.hibernate.dao;

import cn.iocoder.springboot.lab13.hibernate.dataobject.UserDO;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.Objects;

@Repository
public class UserDAO {

    private SessionFactory sessionFactory;

    @Autowired
    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    public void saveUser(UserDO user) {
        Session session = sessionFactory.getCurrentSession();
        session.save(user);
    }



}
